<?php
/**
 * Author: Administrator
 * Date: 2022/7/18 1:56
 */

namespace DesignPatterns\Structural\Composite;


class Input extends FormElement
{
    protected $value;
    protected $name;

    public function __construct($name, $value)
    {
        $this->name = $name;
        $this->value = $value;
    }

    public function render($indent=0): string
    {
        return str_repeat("  ", $indent) . '<input type="text" name="'.$this->name.'" value="'.$this->value.'" />';
    }

}